package com.wyd.qxglht.dao;

import java.util.List;

import javax.transaction.Transactional;

import com.wyd.qxglht.model.Modules;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface IModulesDao extends JpaRepository<Modules, String>, JpaSpecificationExecutor<Modules> {



 //修改模块
 @Transactional
 @Modifying
 @Query("update Modules m set m.name =:name,m.parentId =:parentId,m.path =:path,m.weight =:weight where m.id=:id")
     
 int editModule(String id,String name,Integer parentId,String path,Integer weight);

  //删除模块
  @Transactional
  @Modifying
  @Query("delete Modules m  where m.id=:id")
  int delModule(String id);

  //获取指定用户的角色
    
@Query("select m from Modules m where m.id = :id")
List<Modules> getModule(String id);

}